import type { RouteLocationNormalized, NavigationGuardNext } from 'vue-router'
import { currentRole } from '@/utils/role'
export const useLoginGuard = (
  _to: RouteLocationNormalized,
  _from: RouteLocationNormalized,
  next: NavigationGuardNext
) => {
  const role = currentRole()
  if (role !== 'admin' && role !== 'user') {
    console.log('loginGuard forbidden')
    next('/login')
  } else next()
}
